<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
if(!defined('TinyFW')) exit('Access denied!');
//Register
class tfRegistry {

    private static $objects = array();
    private static $instance;

    private function __construct() {}
    public function __clone() {}

    public static function singleton() {
        if(! is_object( self::$instance )) {
            self::$instance = new self();
        }
        return self::$instance;
    }

    private function get($key) {
        if(is_object(self::$objects[$key])) {
            return self::$objects[$key];
        }
        return null;
    }

    private function set($key,$object) {
        if(! is_object(self::$objects[$key])) {
            self::$objects[$key] = $object;
        }
        return self::$objects[$key];
    }

    public static function getObject($key) {
        return self::singleton()->get($key);
    }

    public static function setObject($key, $object) {
        return self::singleton()->set($key, $object);
    }

    

}


?>
